<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <ul>
        <li>1111111</li>
        <li>2222222</li>
        <li>33333333</li>
        <li>5555555</li>
        <li>6666666</li>
    </ul>
    <script>
        let ul = document.querySelector('ul');
        ul.addEventListener('click',function(e) {
            console.log(ul.lastChild.length);
           let li =  document.querySelectorAll('li')
            for(let i = 0;i < li.length;i++){
                li[i].onclick = function() {
                    for(var i = 0;i<li.length;i++){
                        e.target.style.background = '#fff'
                }
                this.style.background = 'pink'
                    }
            }
        })
    </script>
</body>
</html>